#ifndef XGMEMBERSLOT_H
#define XGMEMBERSLOT_H

class NullClass;

#include "XgSlot.h"

/************************************************************************/
/* Class XgMemberSlot (params: 1) Basic Template                        */
/************************************************************************/
template<class C, typename P1 = NullClass>
class XgMemberSlot : public XgSlot<P1>
{
public:
	typedef void (C::*Method)(P1);
public:
	XgMemberSlot(C* subject, Method method)
		: _subject(subject), _method(method)
	{
	}
public:
	virtual void invoke(P1 a)
	{
		(_subject->*_method)(a);
	}
private:
	C* _subject;
	Method _method;
};

/************************************************************************/
/* Class XgMemberSlot (params: 0)                                       */
/************************************************************************/
template<class C>
class XgMemberSlot<C, NullClass> : public XgSlot<>
{
public:
	typedef void (C::*Method)();
public:
	XgMemberSlot(C* subject, Method method)
		: _subject(subject), _method(method)
	{
	}
public:
	virtual void invoke()
	{
		(_subject->*_method)();
	}
private:
	C* _subject;
	Method _method;
};


#endif //XGMEMBERSLOT_H